use TestHelper;
use Entity;
use EntityBag;

use EntityTest;
use EntityBagTestHelper;

$bag = EntityBag->new();

testClass($bag, "EntityBag");

@expected = qw/CONTENTS CONTENT_LIST/;
@hashes = @expected;
testFields($bag,\@expected, \@hashes);

print "\n";
print "Agregando entidad\n";

$entity = Entity->spawn();
$bag->add($entity);
$catName  = $entity->type;

testCategory($bag, $entity, $catName);

$catName = "prueba";
print "\n";
print "Moviendo a $catName \n";
$bag->add($entity, $catName);

testCategory($bag, $entity, $catName);
testEmptyCategory($bag, $entity->type);
print "\n";
testWhere($bag, $entity, $catName);
print "\n";

print "\n(La proxima prueba debe fallar)\n";
testWhere($bag, $entity, "sdasd");
print "\n";
$entity2 = Entity->spawn();
testAll($bag, $entity);

print "\n(La proxima prueba debe fallar)\n";
testAll($bag, $entity2);
print "\n";

testRemove($bag, $entity, $catName);
print "\n";

